package com.company.biz.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.company.biz.user.mapper.UserLogDao;
import com.company.biz.user.service.UserLogService;
import com.company.common.enums.TableNamePrefixEnum;
import com.company.common.util.IdentifierGeneratorUtil;
import com.company.user.entity.UserLogEntity;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class UserLogServiceImpl extends ServiceImpl<UserLogDao, UserLogEntity> implements UserLogService {

    public void addUserLog(String userId, String ip, String operation, String content){
        UserLogEntity logEntity = new UserLogEntity();
        logEntity.setUserLogId(IdentifierGeneratorUtil.getOwnId(TableNamePrefixEnum.TBUSERLOG));
        logEntity.setUserId(userId);
        logEntity.setClientIp(ip);
        logEntity.setOperation(operation);
        logEntity.setStatus("0");
        logEntity.setCreateTime(new Date());
        logEntity.setContent(content);
        //添加日志
        save(logEntity);
    }

}
